package cn.com.xinjinfu.pdoulcProduct.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.List;
import cn.com.xinjinfu.pdoulcProduct.R;

/**
 * Created by android-adt on 2016/2/23.
 */
public class MenuItemAdapter extends BaseAdapter {
    private LayoutInflater mInflater;
    private List<String> list;

    public void setList(List<String> list) {
        this.list = list;
    }

    public MenuItemAdapter(Context context) {
        this.mInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return list == null ? 0 : list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = mInflater.inflate(R.layout.item_product_fengkong_info, null);
        TextView viewById = (TextView) convertView.findViewById(R.id.textView1);
        String item = list.get(position);
        if (item!=null){
            viewById.setText(item);
        }
        return convertView;
    }
}
